Rails 2.3.5: flash[:notice] disappears after redirect_to call
Posted
by xyzman
on Stack Overflow
See other posts from Stack Overflow
or by xyzman
Published on 2010-05-20T07:09:03Z
Indexed on
2010/05/20
7:30 UTC
Read the original article
Hit count: 193
ruby-on-rails
Here I've got two controller methods:
def invite
if request.post?
begin
email = AccountMailer.create_invite(@user,url)
AccountMailer.deliver(email)
flash[:notice] = "Invitation email sent to #{@user.email}"
rescue
#mail delivery failed
flash[:error] = "Failed to deliver invitation"
end
redirect_to :action => :show, :id => @user.id
end
end
and
def show
@title = "User #{@user.full_name}"
end
The problem is, when I send an invitation, and get redirected to ./show, I see no messages at all. If I change redirect_to to render, the message appears. Still, isn't it intended for flash to work in the immediate subsequent requests?
BTW, I'm using Rails+Passenger setup, could it be so that redirected request goes to another application instance?
© Stack Overflow or respective owner